package controller

import (
	"gitee.com/JackieCode/fabric-go-api/common"
	"github.com/gin-gonic/gin"
)

// ConfigChaincodeRouter 配置与智能合约相关的网关
func ConfigChaincodeRouter(g *gin.RouterGroup) {
	g.POST("/install", ChaincodeInstall)
	g.POST("/instantiate", ChaincodeInstantiate)
	g.POST("/upgrade", ChaincodeUpgrade)
	g.POST("/invoke", ChaincodeInvoke)
	g.POST("/query", ChaincodeQuery)
}

// ChaincodeInstall 安装合约
func ChaincodeInstall(c *gin.Context) {
	var req struct {
		Name     string
		Password string
		Org      string
	}
	if err := c.BindJSON(&req); err != nil {
		c.JSON(500, common.ErrReply(err))
		return
	}
}

// ChaincodeInstantiate 实例化合约
func ChaincodeInstantiate(c *gin.Context) {

}

// ChaincodeUpgrade 升级合约
func ChaincodeUpgrade(c *gin.Context) {}

// ChaincodeInvoke 调用合约（执行增删改的操作）
func ChaincodeInvoke(c *gin.Context) {}

// ChaincodeQuery 调用合约（执行查的操作）
func ChaincodeQuery(c *gin.Context) {}
